<!--********************************************************************
* Copyright© 2000 - 2025 SuperMap Software Co.Ltd. All rights reserved.
*********************************************************************-->
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title data-i18n="resources.title_zoomBox"></title>
</head>
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
<script type="text/javascript" include="bootstrap,widgets.alert" src="../js/include-web.js"></script>
<script type="text/javascript" exclude="iclient-classic" src="../../dist/classic/include-classic.js"></script>
<script type="text/javascript">
    var host = window.isLocal ? window.server : "https://iserver.supermap.io";
    var map, layerWorld;
    var url = host + "/iserver/services/map-world/rest/maps/World";
    map = new SuperMap.Map("map", {
        controls: [
            new SuperMap.Control.Navigation()]
    }, notice());
    function notice() {
        widgets.alert.showAlert(resources.msg_zoomBox,true,300,false,0.8);
    }
    //初始化拉框缩放控件类
    zoombox = new SuperMap.Control.ZoomBox({
        keyMask: SuperMap.Handler.MOD_SHIFT, "autoActivate": true    //设置keyMask属性，使同时按住Shift绘矩形框
    });
    //是否将该控件设置为拉框缩小，默认为false，拉框放大
    zoombox.out = false;
    map.addControl(zoombox);//添加控件
    //获取图层服务地址
    layerWorld = new SuperMap.Layer.TiledDynamicRESTLayer("World", url, {
        transparent: true,
        cacheEnabled: true
    }, {maxResolution: "auto"});

    layerWorld.events.on({"layerInitialized": addLayer});

    //添加地图图层、拉框缩放控件到map
    function addLayer() {
        map.addLayer(layerWorld);
        map.setCenter(new SuperMap.LonLat(0, 0), 1);
    }

</script>
</body>
</html>